package com.shop.admin.enums;

/**
 * 工单状态枚举类
 */
public enum PermTypeEnum {

    SELF(0, "本人"),
    DEPT(1, "本部门"),
    ALL(2, "全部");

    /**
     * 构造方法
     */
    private final int code;
    private final String msg;
    PermTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 获取状态码
     *
     * @author fzr
     * @return Long
     */
    public int getCode() {
        return this.code;
    }

    /**
     * 获取提示
     *
     * @author fzr
     * @return String
     */
    public String getMsg() {
        return this.msg;
    }

    /**
     * 根据编码获取Msg
     *
     * @author fzr
     * @param code 类型
     * @return String
     */
    public static String getMsgByCode(Integer code){
        if(code == null){
            return null;
        }
        for(PermTypeEnum enumItem: PermTypeEnum.values()) {
            if (enumItem.getCode() == code) {
                return enumItem.getMsg();
            }
        }
        return null;
    }

}
